package cs2340.klondike.TaskFudger;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

/**
 * This class creates tabs that are displayed at the top of the screen.
 * These tabs have a label of task, categories, and locations.
 *
 */
public class TabsActivity extends TabActivity {
	/* (non-Javadoc)
	 * @see android.app.ActivityGroup#onCreate(android.os.Bundle)
	 */
	@Override
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tab_layout);
		
		TabHost tabHost = getTabHost();
		
		TabSpec spec1 = tabHost.newTabSpec("Tasks");
		Intent in1 = new Intent(this,TasksActivity.class);
		spec1.setContent(in1);
		spec1.setIndicator("Tasks");
		
		TabSpec spec2 = tabHost.newTabSpec("Categories");
		Intent in2 = new Intent(this,CategoriesActivity.class);
		spec2.setContent(in2);
		spec2.setIndicator("Categories");
		
		TabSpec spec3 = tabHost.newTabSpec("Locations");
		Intent in3 = new Intent(this,LocationsActivity.class);
		spec3.setContent(in3);
		spec3.setIndicator("Locations");
		
		tabHost.addTab(spec1);
		tabHost.addTab(spec2);
		tabHost.addTab(spec3);

		int tabNum = this.getIntent().getIntExtra("TAB_NUMBER", 0);
		Log.d("Tab number","" + tabNum);
		if (tabNum >=0 && tabNum < 3){
			tabHost.setCurrentTab(tabNum);
		}
	}
}